In [3]:
x = range(1,10)
In [4]:
x
Out[4]:
In [7]:
type(x)
Out[7]:
In [5]:
for items in x:
print(items)
In [6]:
type(items)
Out[6]:
In [8]:
y = xrange(1,10)
In [9]:
type(y)
Out[9]:
In [10]:
y
Out[10]:
In [12]:
for items in y:
print(items)
In [3]:
l = []
In [4]:
for item in "String":
l.append(item)
l
Out[4]:
In [6]:
lst_sqrs = [sqrs**2 for sqrs in range(0,10)]
lst_sqrs
Out[6]:
In [9]:
evenos = [evn for evn in range(1,103) if evn%2 == 0]
evenos
Out[9]:
In [11]:
celcisus = [0,32,40,45,49]
farenheight = [temp for temp in celcisus]
farenheight
Out[11]:
In [14]:
farenheight = [(temp*(9/5.0)+32) for temp in celcisus]
farenheight
Out[14]:
In [17]:
lst = [item**2 for item in [item**2 for item in range(11)]]
lst
Out[17]:
In [18]:
lst = [item for item in range(51) if item%3 == 0]
lst
Out[18]:
In [ ]: